package de.koller.caldera.render.textures;

import de.koller.aframe.gl.ATexture;
import de.koller.oceanFramework.gl.util.ParticleTexture;
import org.lwjgl.opengl.GL11;

public class PlanetBorder extends ATexture implements ATexture.ITextureBuilder {

	@Override
	protected void setUp( TextureParameters tparam ) {
		tparam.size = 512;
		tparam.magFilter = GL11.GL_LINEAR;
		tparam.builder = this;
	}

	@Override
	public void build( ParticleTexture texture ) {
		texture.clear( 0x00000000 );
		final float ds = Math.abs( texture.getWidth() * .5f );
		final float c = texture.getWidth() * .5f; 
		for( int x = 0; x < texture.getWidth(); x++ )
			for( int y = 0; y < texture.getHeight(); y++ ) {
				float d = (float)Math.sqrt( (x-c)*(x-c) + (y-c)*(y-c) );
				if( d <= ds )
					texture.setPixel( 0xffffffff, x, y );
			}

	}
	
	
	
}
